<?php
namespace app\index\model;
use think\Model;
use think\Config;
use think\Db;
/**
 * 模型类
 * Class User
 * @package app\api\model
 */
class User extends Model
{


    protected $name = 'user';


    //通过用户名获取用户信息
    public function getUserName($username,$unuid = ''){
        if(!isset($username)) return false;

        $where['A.user_name'] = $username;
        if($unuid!=''){
            $where['A.id'] = ['neq',$unuid];
        }
        $reData = $this->field("A.id,A.role_id,A.user_name,A.true_name,A.password_hash,A.com_id,A.mobile,A.status,B.name as company_name")->alias('A')
            ->join("cy_company B","A.com_id=B.id","left")->where($where)->select();
        if(!$reData) return false;

        return $reData[0];
    }
    //获取用户信息
    public function getUserInfo($where){

        $field = "*";

        return $this->field($field)->alias("A")->where($where)->find();
    }

}
